using Microsoft.EntityFrameworkCore;
using System;

namespace WebApplication8.Data
{
    public abstract class EntityBase
    {
        public string Id { get; set; } = Guid.NewGuid().ToString("N");

    }
    public class AuditingLog : AuditingEntityBase
    {
        public AuditingLog() { }
        public AuditingLog From<Told, Tnew>(Told obj, Tnew objnew, string msg = "")
        {
            return new AuditingLog { OldJson = Newtonsoft.Json.JsonConvert.SerializeObject(obj), NewJson = Newtonsoft.Json.JsonConvert.SerializeObject(objnew), Message = msg };
        }
        public string OldJson { get; set; }
        public string NewJson { get; set; }
        public string Message { get; set; }
    }
    public abstract class AuditingEntityBase : EntityBase
    {
        public String CreatedBy { get; set; }
        public DateTime CreatedAt { get; set; } = DateTime.Now;
        public String UpdatedBy { get; set; }
        public DateTime? UpdatedAt { get; set; }
        public bool IsDeleted { get; set; } = false;
        public DateTime? DeletedAt { get; set; }
    }
}
